using System.Collections.Generic;

namespace DesignPattern.Behavioral.Mediator
{
    public class ChatRoom
    {
        private static List<User> _users = new List<User>();

        public static void AddUser(User user)
        {
            _users.Add(user);
        }

        public static void ShowMessage(User sendMessageUser, string message)
        {
            foreach (var user in _users)
            {
                if (!user.Equals(sendMessageUser))
                {
                    System.Console.WriteLine($"{sendMessageUser.UserName}: {message}");
                }
                else
                {
                    System.Console.WriteLine($"I say: {message}");
                }
            }
        }
    }
}